package require base64

set data {}

foreach f [glob . *] {
    if {[file isfile $f] && [file extension $f] == ".png"} {
	set fh [open $f r]
	fconfigure $fh -translation binary
	lappend data [list [lindex [split [file tail $f] .] 0] [base64::encode [read $fh]]]
	close $fh
    }
}

set fh [open data.txt w]
foreach row $data {
    foreach {n d} $row {
	puts $fh "set $n {
$d
}"
    }
}
close $fh